<!DOCTYPE HTML>
<html>
<head>
    <include file="Public/head"/>
</head>
<body>
<!-- 头部 -->
<!-- /头部 -->

<!-- 主体 -->
<div id="main-container" class="container">
    <div class="row">
        <section>

            <div class="col-xs-9 login " style="background: #ffffff">
                <div class="col-md-6 col-xs-12 lg_left">
                    <div class="col-xs-12">
                        <div class="col-xs-11  lg_lf_top">
                            <h2>欢迎回到 {:C('WEB_SITE')} ！</h2>
                        </div>
                        <div class="clearfix"></div>
                        <form action="__SELF__" method="post" class="lg_lf_form ">
                            <div class="row">
                                <div class="form-group">
                                    <label for="inputEmail" class=".sr-only col-xs-12"></label>

                                    <div class="col-xs-12">

                                        <input type="text" id="inputEmail" class="form-control" placeholder="请输入{$ph}"
                                               ajaxurl="/member/checkUserNameUnique.html" errormsg="请填写1-16位用户名"
                                               nullmsg="请填写用户名"
                                               datatype="*1-16" value="" name="username" autocomplete="off">
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="form-group">
                                    <label for="inputPassword" class=".sr-only col-xs-12"></label>

                                    <div class="col-xs-12">
                                        <div id="password_block" class="input-group">
                                            <input type="password" id="inputPassword" class="form-control"
                                                   placeholder="请输入密码"
                                                   errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">

                                            <div class="input-group-addon"><a style="width: 100%;height: 100%"
                                                                              href="javascript:void(0);"
                                                                              onclick="change_show(this)">show</a></div>
                                        </div>
                                    </div>

                                    <div class="clearfix"></div>
                                </div>
                                <if condition="C(VERIFY_OPEN) eq 1 OR C(VERIFY_OPEN) eq 3">
                                <div class="form-group">
                                    <label for="verifyCode" class=".sr-only col-xs-12" style="display: none"></label>

                                    <div class="col-xs-12 col-md-5 col-xs-offset-1">
                                        <input type="text" id="verifyCode" class="form-control" placeholder="验证码"
                                               errormsg="请填写验证码" nullmsg="请填写验证码" datatype="*5-5" name="verify">
                                    </div>
                                    <div class="col-xs-12 col-md-6 lg_lf_fm_verify">
                                        <img class="verifyimg reloadverify  " alt="点击切换" src="{:U('verify')}"
                                             style="cursor:pointer;max-width: 100%">
                                    </div>
                                    <div class="col-xs-12 Validform_checktip text-warning lg_lf_fm_tip col-xs-offset-1"></div>
                                    <div class="clearfix"></div>
                                </div>
                            </if>
                                <div class="clearfix form-group">
                                    <div class="col-xs-6">
                                        <label>
                                            <input type="checkbox" name="remember" style="cursor:pointer;"> 记住登录
                                        </label>
                                    </div>
                                    <div class="col-xs-6 text-right">
                                        <div class="with-padding"><a class="" href="{:U('Member/mi')}"
                                                                     style="color: #848484;font-size: 12px;">忘记密码？</a></div>
                                    </div>
                                </div>
                            </div>


                            <div class="form-group">
                                <button type="submit" class="btn btn-block btn-primary">登 录</button>
                            </div>


                        </form>
                    </div>
                    <div class="hidden-xs hidden-sm lg_center"></div>
                </div>

                <div class="col-md-6 col-xs-12">

                    <div class="hidden-xs hidden-sm" style="margin: 21px 0 16px 40px;">

                        <h2>没有账号？</h2>
                        <php>if(check_reg_type('username')){</php>
                        <a href="{:U('ucenter/member/register',array('type'=>'username'))}" class="btn btn-block btn-danger btn-lg">用户名注册</a>
                        <php>}</php>
                        <php>if(check_reg_type('email')){</php>
                        <a href="{:U('ucenter/member/register',array('type'=>'email'))}"  class="btn btn-block btn-primary btn-lg">邮箱注册</a>
                        <php>}</php>
                        <php>if(check_reg_type('mobile')){</php>
                        <a href="{:U('ucenter/member/register',array('type'=>'mobile'))}"  class="btn btn-block btn-success btn-lg">手机号注册</a>
                        <php>}</php>
                    </div>

                    <div style="margin-top: 20px;">
                        {:hook('syncLogin')}
                    </div>
                </div>
            </div>


        </section>
    </div>
</div>
<include file="Public/js"/>
<!-- /主体 -->

<!-- 底部 -->
<!-- /底部 -->
<script type="text/javascript">

    $(document)
            .ajaxStart(function () {
                $("button:submit").addClass("log-in").attr("disabled", true);
            })
            .ajaxStop(function () {
                $("button:submit").removeClass("log-in").attr("disabled", false);
            });

    function change_show(obj) {
        if ($(obj).text().trim() == 'show') {
            var value = $('#inputPassword').val().trim();
            var html = '<input type="text" value="' + value + '" id="inputPassword" class="form-control" placeholder="请输入密码" errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">' +
                    '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">hide</a></div>';
            $('#password_block').html(html);
        } else {
            var value = $('#inputPassword').val().trim();
            var html = '<input type="password" value="' + value + '" id="inputPassword" class="form-control" placeholder="请输入密码" errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">' +
                    '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">show</a></div>';
            $('#password_block').html(html);
        }
    }

    $(function () {
        $("form").submit(function () {
            toast.showLoading();
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;


            function success(data) {
                if (data.status) {
                    $('body').append(data.info);
                    toast.success('欢迎回来，页面正在跳转，请稍候。', '温馨提示');
                    setTimeout(function () {
                        window.location.href = data.url;
                    }, 1500);
                } else {
                    toast.error(data.info, '温馨提示');
                    //self.find(".Validform_checktip").text(data.info);
                    //刷新验证码
                    $(".reloadverify").click();
                }
                toast.hideLoading();
            }
        });


        var verifyimg = $(".verifyimg").attr("src");
        $(".reloadverify").click(function () {
            if (verifyimg.indexOf('?') > 0) {
                $(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
            } else {
                $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
            }
        });
    });
</script>
</body>
</html>







